/******************************************************************
 * 文件：EXTI.h
 * 功能：声明外部中断相关函数
 * 日期：2018-02-25
 * 作者：zx
 * 版本：Ver.1.0 | 最初版本
 * 
 * Copyright (C) 2018 zx. All rights reserved.
*******************************************************************/
#ifndef __EXTI_H
#define __EXTI_H

#include "stm32f10x.h"
#include "stm32f10x_exti.h"
#include "KEY/key.h"
#include "OLED/OLED.h"
#include "string.h"
#include "NetWork.h"
#include "LED/LED.h"
#include "DELAY/Delay.h"

#include "FDC2214/bsp_fdc2214.h"
#include "sys.h"
#include "F_I2C/bsp_iic.h"

#include "RELAY/Relay.h"





#define PI 3.1415926   //圆周率
#define MAX 10000000
typedef struct
{
   
    u32 interval;//间隔

    double parameterA_0_9;
    double parameterB_0_9;

    double parameterA_10_13;
    double parameterB_10_13;

    double parameterA_14_23;
    double parameterB_14_23;

    double parameterA_24_31;
    double parameterB_24_31;

    double parameterA_32_34;
    double parameterB_32_34;

    // double parameterA_33_35;
    // double parameterB_33_35;

    // double parameterA_36_42;
    // double parameterB_36_42;

    // double parameterA_43_47;
    // double parameterB_43_47;

    // double parameterA_48_52;
    // double parameterB_48_52;

    // double parameterA_53_57;
    // double parameterB_53_57;

   	// double parameterA_58_62;
    // double parameterB_58_62;

    u8 _1_10;

    u8 _11_14;

    u8 _15_24;

    u8 _25_32;

    u8 _33_35;


   
}Pre_Test;

extern int Tested[100];
extern int Per_num[100];
extern int EXTI_Value[10]; 
extern double Final_Value;
extern u8 presscnt_Baisic,  presscnt_DIF, Enable_flag;
extern u8 Start_Num;			//学习起点
extern int Stage_sta,Test_Num;
extern u32 B_D_sum, Sheet_Num;

extern double parameterA;
extern double parameterB;
extern Pre_Test Is_Test;

void Test_Init(void);
u32 Testing(void);
void Buzzing(u8 times, u16 MS);
void leastSquareLinearFit(int x[], int y[] ,int Stage_start, int num);
void Get_Params(void);
u32 Get_sheet_num(int Y);

void initEXTI_0_1_2(void);

void EXTI0_IRQHandler(void);
void EXTI1_IRQHandler(void);
void EXTI2_IRQHandler(void);

void quickSort(int *a,int left,int right);

#endif
